# global.R defines variables needed in global environment

indexblocks()

# Note: Do not set defaults for a module UNTIL INSIDE THE MODULE 
#    EJAM ejscreenapi module uses its own global.R file:
#   source(system.file("global_EJAMejscreenapi.R", package = "EJAM"))

################### #
# library(shiny)? ####
library(shiny)

################################################################## #
# ~ ####
# ------------------------ ____ SET DEFAULTS / OPTIONS for shiny app ------------------------  ####
# NOTE DEFAULTS HERE ARE UNRELATED TO DEFAULTS IN API module that has its own namespace and is kept separate, like default radius, etc.
# * Note each time a user session is started, the application-level option set is duplicated, for that session.
# * If the options are set from inside the server function, then they will be scoped to the session.
#     LET ADVANCED USERS ADJUST THESE, as INPUTS ON ADVANCED SETTINGS TAB

######################################################## #
# Options in general & Testing ####

## Bookmarking allowed ####
bookmarking_allowed <- TRUE  # https://mastering-shiny.org/action-bookmark.html
if (bookmarking_allowed) {enableBookmarking(store = "url")}


default_testing        <- FALSE
default_shiny.testmode <- FALSE  # If TRUE, then various features for testing Shiny applications are enabled.
default_print_uploaded_points_to_log <- TRUE

## disable autoloading of .R files
options(shiny.autoload.r = FALSE)
# show generalized errors in the UI
options(shiny.sanitize.errors = TRUE)

## Loading/wait spinners (color, type) ####
## note: was set at type = 1, but this caused screen to "bounce"
options(spinner.color = "#005ea2", spinner.type = 4)

## app title & version   ###########################################
# note that manage-public-private.R is sourced prior to global.R being source, by run_app()
desc <- try(desc::desc(file = "DESCRIPTION"))
if (inherits(desc, 'try-error')) {desc <- try(desc::desc(package = "EJAM"))}
if (inherits(desc, 'try-error')) {desc <- desc::desc(file = EJAM:::app_sys('DESCRIPTION'))}
if (inherits(desc, 'try-error')) {stop('cannot find DESCRIPTION file in working directory or in EJAM package')}
ejam_app_version <- desc$get("Version")
## trim version number to Major.Minor
ejam_app_version <- substr(ejam_app_version, start = 1, stop = gregexpr('\\.',ejam_app_version)[[1]][2] - 1)

acs_version_global      <- desc$get("ACSVersion")#as.vector(metadata_mapping$blockgroupstats[['acs_version']]) # "2017-2021"
ejscreen_version_global <- desc$get("EJScreenVersion")#as.vector(metadata_mapping$blockgroupstats[['ejam_package_version']])

## constant to show/hide EPA HTML header and footer in app UI
## for public branch, want to hide so it can be legible when embedded as an iframe
show_full_header_footer <- FALSE

# advanced tab ####
default_hide_advanced_settings <- TRUE

## (IP address  for ejscreenapi module) ###########################################
# ips <- c('10.147.194.116', 'awsgeopub.epa.gov', '204.47.252.51', 'ejscreen.epa.gov')
# whichip <- ips[4]

######################################################## #
# Options in site point or file uploads, radius  ####

## Limits on # of points etc. ####

## Options in file upload size max
minmax_mb_upload = 5 # MB
default_max_mb_upload = 50 # MB (note shiny default is only 5 MB)
maxmax_mb_upload = 350 # MB
options(shiny.maxRequestSize = default_max_mb_upload * 1024^2)

# input$max_pts_upload
default_max_pts_upload  <-   5 * 1000
maxmax_pts_upload  <-  10 * 1000 #   cap uploaded points

### THESE 2 ARE NOT USED ANYMORE I THINK:
max_points_can_map    <- 15 * 1000  # *** EJAM only not api
marker_cluster_cutoff  <- 1 * 1000  # *** EJAM only not api; for leaflet markerClusters

# input$max_pts_map uses these as its starting value and max allowed value
default_max_pts_map   <- 5 * 1000
maxmax_pts_map       <- 15 * 1000 # max we will show on map

# input$max_pts_showtable uses these as its starting value and max allowed value
default_max_pts_showtable <- 1000 # max to show in interactive viewer. It drops the rest.
maxmax_pts_showtable  <- 5 * 1000 # 10k is extremely slow. check server side vs client side

# input$max_pts_run uses these as its starting value and max allowed value
default_max_pts_run  <-  1 * 1000 # initial cap but can adjust in advanced tab
maxmax_pts_run       <- 15 * 1000 # absolute max you can analyze here, even with advanced tab

# input$max_shapes_map uses these as its starting value and max allowed value
default_max_shapes_map <- 159 # TX has 254 counties, but no other state exceeds 159. EJAM::blockgroupstats[ , data.table::uniqueN(substr(bgfips, 1,5)), by = ST][order(V1), ]
maxmax_shapes_map <- 254  # TX has 254 counties

use_shapefile_from_any <-  FALSE # newer code when ready will handle more spatial formats like .json etc.

## ------------------------ Radius options  #####

#   radius miles for slider input where user specifies radius. Note 5 km is 3.1 miles, 10 km is 6.2 miles ; and 10 miles is 16 kilometers (10 * meters_per_mile/1000). 50 km is too much/ too slow.
minradius  <- 0.50 # miles -- significant uncertainty as radius shrinks, at least if blockgroups are small such as if # of blockgroups in circle << 30.
minradius_shapefile <- 0
default_default_miles_shapefile <- 0
stepradius <- 0.05 # miles.  0.25 allows quarter miles. 0.10 allows tenths. 0.05 is awkwardly small but allows both quarter mile and tenth of mile.

# input$default_miles
default_default_miles <- 1 # and can override this with run_app(radius=3.1), and also see effects of bookmarked advanced settings
max_default_miles <- 50 * 1000 / meters_per_mile # 50 km. EJAM::meters_per_mile is lazyloaded data constant.

# input$max_miles
default_max_miles  <- 10 #
maxmax_miles <- 50 * 1000 / meters_per_mile # 50 km.

######################################################## #
## EPA Programs (to limit NAICS/ facilities query) ####
## used by inputId 'ss_limit_fac1' and 'ss_limit_fac2'
default_epa_program_selected <- "CAMDBS" # has only about 739 sites
# cbind(epa_programs)
# sort(unique(frs_by_programid$program)) # similar  # EJAM :: frs_by_programid

######################################################################################################## #

# Options in calculations & what stats to output ####

### calculate and/or include in downloaded outputs ------------- #

default_calculate_ratios <- TRUE   # probably need to calculate even if not shown in excel download, since plots and short summary report rely on them/
default_include_averages <- TRUE
default_include_extraindicators <- TRUE
### other params that might be added here and in advanced tab:
# ejamit( 
#   include_ejindexes = , 
#   extra_demog = , 
#   countcols = , popmeancols = ,  calculatedcols = ,
#   need_proximityscore = , 
#   subgroups_type = , 
#   testing = )



######################################################## #

# Options for viewing results  ####



##  Map colors, weights, opacity (for ejscreenapi module?) ####
### in ejscreenapi global.R:
default_circleweight <- 4
# opacitymin   <- 0
# opacitymax   <- 0.5
# opacitystep  <- 0.025
# opacitystart <- 0.5
# opacityratio <- 2 / 5
# base_color_default      <- "blue"  ;
# cluster_color_default   <- "red"   ;
# highlight_color_default <- 'orange';

# (predict time to complete for ejscreenapi module) ####
# perhourslow  <- 3000  # to give an estimate of how long it will take
# perhourguess <- 6000  # seeing 8k if 1 mile, 4.7k if 5 miles, roughly. 207 ECHO run was 2 . 1  minutes, 5.9k/hr.
# perhourfast <- 12000  # approx 12k RMP sites would take almost 2 hours (1 to 2 hours, or even 4?).
# report_every_n_default <- 100

## (download as excel vs csv, for ejscreenapi module) ####
# asExcel <- TRUE # WHETHER TO DOWNLOAD RESULTS AS EXCEL OR CSV

######################################################## #

### Excel formatting options   --------------------- #


# heatmap column names - defaults could be set here and made flexible in advanced tab


# heatmap cutoffs for bins - defaults could be set here and made flexible in advanced tab


# heatmap colors for bins - defaults could be set here and made flexible in advanced tab



default_ok2plot <- TRUE # the plots to put in excel tabs via table_xls_from_ejam() and table_xls_format() and the plot functions


############################################################################## # # #

# relevant to EJAM only, not api:

################################ #

### in getblocksnearby()  ------------- #

default_avoidorphans        <- FALSE # seems like EJScreen itself essentially uses FALSE? not quite clear
default_maxradius <-  31.06856  # max search dist if no block within radius # 50000 / meters_per_mile #, # 31.06856 miles !!
# also used as the maxmax allowed

### in doaggregate()   ------------- #

## demog subgroups type
default_subgroups_type <- 'nh'
# this sets the default in the web app only, not in functions doaggregate() and ejamit() and plot_distance_mean_by_group() etc.,
# if used outside web app app_server and app_ui code, as in using datacreate_testpoints_testoutputs.R
# "nh" for non-hispanic race subgroups as in Non-Hispanic White Alone, nhwa and others in names_d_subgroups_nh;
# "alone" for EJScreen v2.2 style race subgroups as in    White Alone, wa and others in names_d_subgroups_alone;
# "both" for both versions. Possibly another option is "original" or "default" but work in progress.

default_need_proximityscore <- FALSE # need_proximityscore is a param in doaggregate() or ejamit()
default_include_ejindexes   <- TRUE # include_ejindexes is a param in doaggregate() or ejamit()
default_extra_demog <- TRUE # extra_demog is a param in  doaggregate() or ejamit(),
# label = "Need extra indicators from EJScreen v2.2 report, on language, age groups, gender, percent with disability, poverty, etc.",


######################################################## #
### Short report options --------------------- #

default_standard_analysis_title <-  'Summary of EJ Analysis' # Default title to show on each short report
default_plotkind_1pager <- "bar"  #    Bar = "bar", Box = "box", Ridgeline = "ridgeline"




######################################################## #
### Long report options  --------------------- #

# relocate any here from the Full Report tab?? - defaults could be set here and made flexible elsewhere ***








######################################################## #
## Threshold comparisons options  ####
# stats summarizing EJ percentiles to count how many are at/above threshold percentile(s)

# label for each group of indicators
## newer way:
default.an_threshgroup1 = "EJ-US-or-ST"
default.an_threshgroup2 = "Supp-US-or-ST"
### threshgroups = list("EJ-US-or-ST", "Supp-US-or-ST"), # list(c("EJ US", "EJ State", "Suppl EJ US", "Suppl EJ State")), # list("EJ US", "EJ State", "Suppl EJ US", "Suppl EJ State"), # list("variables"),
### threshgroups = list(input$an_threshgroup1, input$an_threshgroup2),
## older way:
# threshgroup.default <- list(
#   'comp1' = "EJ US pctiles",  'comp2' = "EJ State pctiles"
# )

# variable names of indicators compared to threshold
## newer way:
default.an_threshnames1 = c(names_ej_pctile, names_ej_state_pctile) # regular in US or ST
default.an_threshnames2 = c(names_ej_supp_pctile, names_ej_supp_state_pctile) # supplemental in US or ST
### threshnames = list(input$an_threshnames1, input$an_threshnames2)
### threshnames = list(c(names_ej_pctile, names_ej_state_pctile), c(names_ej_supp_pctile, names_ej_supp_state_pctile)), # list(c(names_ej_pctile, names_ej_state_pctile, names_ej_supp_pctile, names_ej_supp_state_pctile)),  #list(names_ej_pctile, names_ej_state_pctile, names_ej_supp_pctile, names_ej_supp_state_pctile),  # list(names(which(sapply(sitestats, class) != "character")))
## older way:
### used defaults built into batch.summarize()

# what threshold to compare to
## newer way:
default.an_thresh_comp1 = 80 # regular
default.an_thresh_comp2 = 80 # supplemental
### thresholds   = list(input$an_thresh_comp1, input$an_thresh_comp2)
### thresholds   = list(90, 90) # percentile threshold(s) to compare to like to 90th
## older way:
# threshold.default <- c('comp1' = 90, 'comp2' = 80)

######################################################## #
## QUANTILES ...  can be used by inputId 'an_list_pctiles'    #   CHECK IF THESE UNITS SHOULD BE 0-1 OR 0-100 ***
probs.default.selected <- c(   0.25,            0.80,     0.95)   #   CHECK IF THESE UNITS SHOULD BE 0-1 OR 0-100 ***
probs.default.values   <- c(0, 0.25, 0.5, 0.75, 0.8, 0.9, 0.95, 0.99, 1)  #   CHECK IF THESE UNITS SHOULD BE 0-1 OR 0-100 ***
probs.default.names <- formatC(probs.default.values, digits = 2, format = 'f', zero.print = '0')



################################################################# #
# END OF DEFAULTS / OPTIONS / SETUP
################################################################# #

## Sanitize functions
sanitize_text = function(text) {
  gsub("[^a-zA-Z0-9 .-]", "", text)  
}

sanitize_numeric <- function(text) {
  cleaned_text <- gsub("[^0-9.-]", "", as.character(text))
  
  # Ensure only one decimal point
  cleaned_text <- sub("([0-9]*[.][0-9]*).*", "\\1", cleaned_text)
  
  cleaned_text <- sub("(.)-(.)", "\\1\\2", cleaned_text)
  cleaned_text <- sub("^(-?).*?(-?.*)$", "\\1\\2", cleaned_text)
  
  numeric_value <- as.numeric(cleaned_text)
  
  if (is.na(numeric_value)) {
    return(NA)
  } else {
    return(numeric_value)
  }
}

escape_html <- function(text) {
  text <- gsub("&", "&amp;", text)
  text <- gsub("<", "&lt;", text)
  text <- gsub(">", "&gt;", text)
  text <- gsub("\"", "&quot;", text)
  text <- gsub("'", "&#39;", text)
  return(text)
}



# ~ ####



# ------------------------ ____ HELP TEXT ------------------------  ####



## info text for "About EJAM" tab ####

intro_text <- tagList(
  # tags$p("For more information about EJAM:"),
  h2( a(href = "https://usepa.github.io/EJAM/articles/0_whatis.html",
        "What is EJScreen's EJAM tool?", 
        target = "_blank", rel = "noreferrer noopener") ),
  p("EJScreen's multisite tool (EJAM) is a tool developed by the United States Environmental Protection Agency (US EPA) that makes it easy to see demographic and environmental information summarized in and across any list of places in the nation. Using this tool is like getting a typical EJScreen report, but for hundreds or thousands of places, all at the same time."),
  p("This provides interactive results and a formatted, ready-to-share report with tables, graphics, and a map. The report can provide EJ-related information about people who live in communities near any of the industrial facilities on a list, for example."),
  br(),
  br()
)

## help text for ECHO facility search: echo_message ####
## used by inputId 'ss_search_echo'

echo_url <-  'https://echo.epa.gov/facilities/facility-search' # used in server.R and in message below
echo_message <- shiny::HTML(paste0('To use the ECHO website to search for and specify a list of regulated facilities,
                                    <br>1) Go to ', '<a href=\"', echo_url, '\", target=\"_blank\" rel=\"noreferrer noopener\">', echo_url,  '</a>', ' and <br>
                                    2) Navigate website and select categories to include in data, then <br>
                                    3) Under Search Criteria Selected-Facility Characteristics-Results View select <b>Data Table</b> and click <b>Search</b>, then <br>
                                    3) click Customize Columns, use checkboxes to include Latitude and Longitude, then <br>
                                    4) click Download Data, then <br>
                                    5) Return to this app to upload that ECHO site list.<br>'))

## help text for upload: latlon_help_msg ####

latlon_help_msg <- '
<div class="row">
  <div class="col-sm-12">
  <div class="well">
  <div id="selectFrom1" class="form-group shiny-input-radiogroup shiny-input-container shiny-input-container-inline">
  <label class="control-label" for="selectFrom1">
  <p>You may upload a list of location coordinates (latitudes and longitudes).</p>
  <p>The file should contain at least these two columns: lat and lon.
  There can be other columns like an ID column that should be unique (no duplicates),
  and each record should be separated by a carriage return.</p>
  <p>It also will work with some alternative names (and case insensitive) like
  Latitude, Lat, latitude, long, longitude, Longitude, Long, LONG, LAT, etc.
  but to avoid any mixup of names it is suggested that the file use lat and lon. </p>
  <p>The file could be formatted as follows, for example: </p>
  </label>
  <br>
  ID,lat,lon<br>
  1,36.26333,-98.48083<br>
  2,41.01778,-80.36194<br>
  3,43.43772,-91.90365<br>
  4,29.69083,-91.34333<br>
  5,40.11389,-75.34806<br>
  6,35.97889,-78.88056<br>
  7,32.82556,-89.53472<br>
  8,30.11275,-83.59778<br>
  9,30.11667,-83.58333<br>
  10,38.06861,-88.75361<br><br>
  </div>
  </div>
  </div>
  </div>'

## help text for upload: shp_help_msg ####

shp_help_msg <- '
<div class="row">
  <div class="col-sm-12">
  <div class="well">
  <div id="selectFrom1" class="form-group shiny-input-radiogroup shiny-input-container shiny-input-container-inline">
  <label class="control-label" for="selectFrom1">
  <p>You may upload a set of shapefiles with polgyons.</p>
  <p>The upload should contain at least these four related file types: .shp, .shx, .dbf, .prj
  or can be a .zip containing those, or a .gdb.zip file.</p>
  </div>
  </div>
  </div>
  </div>'

## help text for upload: frs_help_msg ####

frs_help_msg <- HTML('  <div class="row">
    <div class="col-sm-12">
      <div class="well">
        <div id="selectFrom1" class="form-group shiny-input-radiogroup shiny-input-container shiny-input-container-inline">
          <label class="control-label" for="selectFrom1">
            <h5>You may upload a list of FRS IDs. The FRS ID should be in the second column. It should be unique (no duplicates), and it should be titled REGISTRY_ID. Each record should be separated by a carriage return. </h5>
            <h5>The file should be formatted as follows: </h5>
          </label>
					<br>num,REGISTRY_ID<br>
		      1,110000308006<br>
		      2,110000308015<br>
      		3,110000308024<br>
		      4,110000308202<br>
      		5,110000308211<br>
		      6,110000308220<br>
      		7,110000308346<br>
		      8,110000308355<br>
		      9,110000308364<br>
		      <br>
        </div>
      </div>
    </div>
  </div>')

## help text for upload: epa_program_help_msg ####

epa_program_help_msg <- '
<div class="row">
  <div class="col-sm-12">
  <div class="well">
  <div id="selectFrom1" class="form-group shiny-input-radiogroup shiny-input-container shiny-input-container-inline">
  <label class="control-label" for="selectFrom1">
  <p>You may upload a list of EPA Programs and Program IDs.</p>
  <p>The file should contain at least these two columns: program and pgm_sys_id.
  There can be other columns like an ID column that should be unique (no duplicates),
  and each record should be separated by a carriage return.</p>
  <p>It also will work with additional optional columns such as Facility Registry ID (REGISTRY_ID), latitude (lat), and longitude (lon). </p>
  <p>The file could be formatted as follows, for example: </p>
  </label>
  <br>
  program,	pgm_sys_id<br>
NC-FITS,	28122<br>
AIR,	NY0000004432800019<br>
NPDES,	GAR38F1E2<br>
TRIS,	7495WCRHMR59SMC<br>
MN-TEMPO,	17295<br>
HWTS-DATAMART,	CAR000018374<br>
IN-FRS,	330015781585<br>
TX-TCEQ ACR,	RN104404751<br>
NJ-NJEMS,	353065<br>
AIR,	IL000031012ACJ<br>
  </div>
  </div>
  </div>
  </div>'

## help text for upload: fips_help_msg ####

fips_help_msg <- paste0('
<div class="row">
  <div class="col-sm-12">
  <div class="well">
  <div id="selectFrom1" class="form-group shiny-input-radiogroup shiny-input-container shiny-input-container-inline">
  <label class="control-label" for="selectFrom1">
  <p>You may upload a list of FIPS codes specified at the State (2-digit), County (5-digit),',
                        # ' Census Designated Place (CDP) like city or township (6-digit or 7-digit),',   # uncomment this when ready ***
                        ' Tract (11-digit), or blockgroup (12 digit), or even block (15-digit fips).</p>
  <p>The file should contain at least one column, FIPS, with the fips codes. ',
                        'It will also work with the following aliases: ',
                        'fips, fips_code, fipscode, Fips, statefips, countyfips, ST_FIPS, st_fips
  ',
                        'There can be other columns like an ID column that should be unique (no duplicates),
  and each record should be separated by a carriage return.</p>
  <p>The file could be formatted as follows, for example: </p>
  </label>
  <br>
 FIPS<br>
36001014002<br>
26163594300<br>
36029008600<br>
36061006100<br>
15003005300<br>
17031081403<br>
06037190303<br>
29031881301<br>
45091061205<br>
  </div>
  </div>
  </div>
  </div>')

#################################################################################################################### #
# ~ ####
# ------------------------ ____ TEMPLATE ONE EPA SHINY APP WEBPAGE _______ ####

html_header_fmt <- tagList(
  #################################################################################################################### #
  
  
  # WHERE TO FIND THIS template  #
  # browseURL("https://github.com/USEPA/webcms/blob/main/utilities/r/OneEPA_template.R")
  # but also see
  # https://www.epa.gov/themes/epa_theme/pattern-lab/patterns/pages-standalone-template/pages-standalone-template.rendered.html
  # START OF ONEEPA SHINY APP WEB UI TEMPLATE to insert within your fluid page
  #################################################################################################################### #
  
  tags$html(class = "no-js", lang = "en"),
  
  ### head ####
  
  tags$head(
    HTML(
      "<!-- Google Tag Manager -->
  		  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  		new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  		j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  		'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  		})(window,document,'script','dataLayer','GTM-L8ZB');</script>
  		<!-- End Google Tag Manager -->"
    ),
    tags$meta(charset="utf-8"),
    tags$meta(property="og:site_name", content="US EPA"),
    
    #tags$link(rel = "stylesheet", type = "text/css", href = "css/uswds.css"),
    tags$link(rel="stylesheet", type = "text/css", href = "https://cdnjs.cloudflare.com/ajax/libs/uswds/3.0.0-beta.3/css/uswds.min.css", integrity="sha512-ZKvR1/R8Sgyx96aq5htbFKX84hN+zNXN73sG1dEHQTASpNA8Pc53vTbPsEKTXTZn9J4G7R5Il012VNsDEReqCA==", crossorigin="anonymous", referrerpolicy="no-referrer"),
    tags$link(rel="canonical", href="https://www.epa.gov/themes/epa_theme/pattern-lab/.markup-only.html"),
    tags$link(rel="shortlink", href="https://www.epa.gov/themes/epa_theme/pattern-lab/.markup-only.html"),
    
    tags$meta(property="og:url", content="https://www.epa.gov/themes/epa_theme/pattern-lab/.markup-only.html"),
    tags$meta(property="og:url", content="https://www.epa.gov/themes/epa_theme/pattern-lab/.markup-only.html"),
    tags$meta(property="og:image", content="https://www.epa.gov/sites/all/themes/epa/img/epa-standard-og.jpg"),
    tags$meta(property="og:image:width", content="1200"),
    tags$meta(property="og:image:height", content="630"),
    tags$meta(property="og:image:alt", content="U.S. Environmental Protection Agency"),
    tags$meta(name="twitter:card", content="summary_large_image"),
    tags$meta(name="twitter:image:alt", content="U.S. Environmental Protection Agency"),
    tags$meta(name="twitter:image:height", content="600"),
    tags$meta(name="twitter:image:width", content="1200"),
    tags$meta(name="twitter:image", content="https://www.epa.gov/sites/all/themes/epa/img/epa-standard-twitter.jpg"),
    tags$meta(name="MobileOptimized", content="width"),
    tags$meta(name="HandheldFriendly", content="true"),
    tags$meta(name="viewport", content="width=device-width, initial-scale=1.0"),
    tags$meta(`http-equiv`="x-ua-compatible", content="ie=edge"),
    
    ## >> APP TITLE could be defined here ####
    # AND in golem_add_external_resources() IN app_ui.R,  
    # AND BELOW IN SHORT VERSION OF HEADER
    
    # tags$title('EJAM | US EPA'),
    tags$meta(name = "application-name", content = .app_title),
    
    ## EPA FAVICONS - but can be specified in (and this would conflict with) golem_add_external_resources() within app_ui.R ####
    
    # try to let app_ui.R define the main favicon instead of using the EPA one....
    # tags$link(rel="icon",                      href="https://www.epa.gov/themes/epa_theme/images/favicon-32.png", sizes="32x32"),
    # tags$link(rel="icon", type="image/x-icon", href="https://www.epa.gov/themes/epa_theme/images/favicon.ico"),
    
    tags$meta(name="msapplication-TileColor", content="#FFFFFF"),
    tags$meta(name="msapplication-TileImage", content="https://www.epa.gov/themes/epa_theme/images/favicon-144.png"),
    
    tags$meta(name="msapplication-config", content="https://www.epa.gov/themes/epa_theme/images/ieconfig.xml"),
    tags$link(rel="apple-touch-icon-precomposed", sizes="196x196", href="https://www.epa.gov/themes/epa_theme/images/favicon-196.png"),
    tags$link(rel="apple-touch-icon-precomposed", sizes="152x152", href="https://www.epa.gov/themes/epa_theme/images/favicon-152.png"),
    tags$link(rel="apple-touch-icon-precomposed", sizes="144x144", href="https://www.epa.gov/themes/epa_theme/images/favicon-144.png"),
    tags$link(rel="apple-touch-icon-precomposed", sizes="120x120", href="https://www.epa.gov/themes/epa_theme/images/favicon-120.png"),
    tags$link(rel="apple-touch-icon-precomposed", sizes="114x114", href="https://www.epa.gov/themes/epa_theme/images/favicon-114.png"),
    tags$link(rel="apple-touch-icon-precomposed", sizes="72x72", href="https://www.epa.gov/themes/epa_theme/images/favicon-72.png"),
    tags$link(rel="apple-touch-icon-precomposed", href="https://www.epa.gov/themes/epa_theme/images/favicon-180.png"),
    
    
    
    tags$link(rel="preload", href="https://www.epa.gov/themes/epa_theme/fonts/source-sans-pro/sourcesanspro-regular-webfont.woff2", as="font", crossorigin="anonymous"),
    tags$link(rel="preload", href="https://www.epa.gov/themes/epa_theme/fonts/source-sans-pro/sourcesanspro-bold-webfont.woff2", as="font", crossorigin="anonymous"),
    tags$link(rel="preload", href="https://www.epa.gov/themes/epa_theme/fonts/merriweather/Latin-Merriweather-Bold.woff2", as="font", crossorigin="anonymous"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/ajax-progress.module.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/autocomplete-loading.module.css?r6lsex" ),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/js.module.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/sticky-header.module.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/system-status-counter.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/system-status-report-counters.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/system-status-report-general-info.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/tabledrag.module.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/tablesort.module.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/core/themes/stable/css/system/components/tree-child.module.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/themes/epa_theme/css/styles.css?r6lsex"),
    tags$link(rel="stylesheet", media="all", href="https://www.epa.gov/themes/epa_theme/css-lib/colorbox.min.css?r6lsex"),
    
    tags$script(src = 'https://cdnjs.cloudflare.com/ajax/libs/uswds/3.0.0-beta.3/js/uswds-init.min.js'),
    #fix container-fluid that boostrap RShiny uses
    tags$style(HTML(
      '.container-fluid {
              
              padding-right: 0;
              padding-left: 0;
              padding-bottom: 0;
              padding-top: 0;
              margin-right: 0;
              margin-left: 0;
              margin-bottom: 0;
              margin-top: 0
              }
          .tab-content {
              margin-right: 30px;
              margin-left: 30px;
          }'
    ))
  ), 
  
  
  ### >> APP TITLE in Header/ Body tag ####
  
  tags$body(
    class = "path-themes not-front has-wide-template", id = "top",
    tags$script(src = 'https://cdnjs.cloudflare.com/ajax/libs/uswds/3.0.0-beta.3/js/uswds.min.js')
    
  ),    
  
  ######################################################################## #
  if (!show_full_header_footer) {
    
    ### THIN HEADER ROW/ TITLE ####
    
    HTML(paste0('
     <div class="container-fluid" style="border-spacing: 0; margin: 0; padding-bottom: 0; border: 0;
     border-right-width: 0px; font-size:24px; ";>
  
  <div id="ejamheader">
    
    <table width="100%" style="margin-bottom: 0px; margin-top: 0px";><tbody>
      <tr style="font-size:24px margin-bottom: 0px; margin-top: 0px";>
      
        <td width="74px" valign="top" style=
          "border-bottom-color: #ffffff; border-top-color: #ffffff; border-left-color: #ffffff; border-right-color: #ffffff;
          margin-bottom: 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; 
          padding-bottom: 0px; padding-top: 0px; padding-left: 0px; padding-right: 0px">

          <img id="titleLogo" src="https://ejscreen.epa.gov/mapper/images/epa_logo_horizBlue.png" 
            style="margin: 0px; padding-bottom: 4px; padding-top: 4px; padding-left: 4px; padding-right: 4px" alt="EPA" title="EPA">
        </td>

        <td valign="bottom" style="line-height:34px; padding: 0px; 
        border-bottom-color: #ffffff; border-top-color: #ffffff; border-left-color: #ffffff; border-right-color: #ffffff";
        vertical-align: bottom;>
        
                <span style="font-size: 17pt; font-weight:700; font-family:Arial";>',   # large font for app title
                
                .app_title,   # see manage-public-private.R
                
                '</span>',
                
                '<span style="font-size: 10pt; font-weight:700; font-family:Arial";>',  # smaller font for version info
                
                .app_version_headertext,  # see manage-public-private.R, e.g., " (Version 2.3)" 
                
                '</span>',
                '
                                                        
<!-- 
<span style="font-size: 10pt; font-weight:700;";>

&nbsp;&nbsp;EJ Analysis Multisite Tool (version 2.3)

</span>
--> 
        </td>', 
      ### > links ####         
      # could adjust which of the links here get shown in the header, depending on  isTRUE(golem_opts$isPublic)           
' 
        <td valign="bottom" align="right";  style="line-height:34px; padding: 0px;
                border-bottom-color: #ffffff; border-top-color: #ffffff; border-left-color: #ffffff; border-right-color: #ffffff";>
          <span id="homelinks">
            <a href="https://www.epa.gov/ejscreen" alt="Go to EJScreen home page" title="Go to EJScreen home page" target="_blank">EJScreen Website</a> | 
            <a href="https://ejscreen.epa.gov/mapper/" alt="Go to EJScreen mapper"    title="Go to EJScreen mapper" target="_blank">EJScreen Mapper</a> | 
            <a href="https://www.epa.gov/ejscreen/overview-socioeconomic-indicators-ejscreen" alt="Go to EJScreen glossary page" title="Go to EJScreen glossary page" target="_blank">Glossary</a> | 
            <a href="www/ejscreen-multisite-help-2025-01.pdf" alt="Go to help document" title="Go to help document" target="_blank">Help</a> | 
            <a href="mailto:ENVIROMAIL_GROUP@epa.gov?subject=EJScreen%20Multisite%20Tool%20Question" id="emailLink" alt="Contact Us" title="Contact Us">Contact Us</a>
          </span>&nbsp;&nbsp;
        </td>
 ',

                
 '              
      </tr>
    </tbody></table>
    
  </div>
  
</div>
     ',
                
                ########################################################################## #
                
                #HTML(
                '<div class="l-page  has-footer" style="padding-top:0">
        <div class="l-constrain">
        
          
 '
    ))
    ########################################################################## #
    ########################################################################## #
    
  } else {
    
    ### (OPTIONAL LARGER EPA HEADER) ####
    
    # To display the full header, html_header_fmt can be set to NULL or an empty tagList
    HTML(
      '<div class="skiplinks" role="navigation" aria-labelledby="skip-to-main">
            <a id="skip-to-main" href="#main" class="skiplinks__link visually-hidden focusable">Skip to main content</a>
         </div>

      	<!-- Google Tag Manager (noscript) -->
      	<noscript><iframe src=https://www.googletagmanager.com/ns.html?id=GTM-L8ZB
      	height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
      	<!-- End Google Tag Manager (noscript) -->

          <div class="dialog-off-canvas-main-canvas" data-off-canvas-main-canvas>


          <section class="usa-banner" aria-label="Official government website">

            <div class="usa-accordion">

              <header class="usa-banner__header">
                <div class="usa-banner__inner">
                  <div class="grid-col-auto">
                    <img class="usa-banner__header-flag" src="https://www.epa.gov/themes/epa_theme/images/us_flag_small.png" alt="U.S. flag" />
                  </div>
                  <div class="grid-col-fill tablet:grid-col-auto">
                    <p class="usa-banner__header-text">An official website of the United States government</p>
                    <p class="usa-banner__header-action" aria-hidden="true">Here’s how you know</p>
                  </div>
                  <button class="usa-accordion__button usa-banner__button" aria-expanded="false" aria-controls="gov-banner">
                    <span class="usa-banner__button-text">Here’s how you know</span>
                  </button>
                </div>
              </header>

              <div class="usa-banner__content usa-accordion__content" id="gov-banner">
                <div class="grid-row grid-gap-lg">
                  <div class="usa-banner__guidance tablet:grid-col-6">
                    <img class="usa-banner__icon usa-media-block__img" src="https://www.epa.gov/themes/epa_theme/images/icon-dot-gov.svg" alt="Dot gov">
                    <div class="usa-media-block__body">
                      <p>
                        <strong>Official websites use .gov</strong>
                        <br> A <strong>.gov</strong> website belongs to an official government organization in the United States.
                      </p>
                    </div>
                  </div>
                  <div class="usa-banner__guidance tablet:grid-col-6">
                    <img class="usa-banner__icon usa-media-block__img" src="https://www.epa.gov/themes/epa_theme/images/icon-https.svg" alt="HTTPS">
                    <div class="usa-media-block__body">
                      <p>
                        <strong>Secure .gov websites use HTTPS</strong>
                        <br> A <strong>lock</strong> (<span class="icon-lock"><svg xmlns="http://www.w3.org/2000/svg" width="52" height="64" viewBox="0 0 52 64" class="usa-banner__lock-image" role="img" aria-labelledby="banner-lock-title banner-lock-description"><title id="banner-lock-title">Lock</title><desc id="banner-lock-description">A locked padlock</desc><path fill="#000000" fill-rule="evenodd" d="M26 0c10.493 0 19 8.507 19 19v9h3a4 4 0 0 1 4 4v28a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V32a4 4 0 0 1 4-4h3v-9C7 8.507 15.507 0 26 0zm0 8c-5.979 0-10.843 4.77-10.996 10.712L15 19v9h22v-9c0-6.075-4.925-11-11-11z"/></svg></span>) or <strong>https://</strong> means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.
                      </p>
                    </div>
                  </div>
                </div>
              </div>

            </div>

          </section>


          <div>
            <div class="js-view-dom-id-epa-alerts--public">
              <noscript>
                <div class="usa-site-alert usa-site-alert--info">
                  <div class="usa-alert">
                    <div class="usa-alert__body">
                      <div class="usa-alert__text">
                        <p>JavaScript appears to be disabled on this computer. Please <a href="/alerts">click here to see any active alerts</a>.</p>
                      </div>
                    </div>
                  </div>
                </div>
              </noscript>
            </div>
          </div>

          <header class="l-header">

            <div class="usa-overlay"></div>
            <div class="l-constrain">

              <div class="l-header__navbar">

                <div class="l-header__branding">
                  <a class="site-logo" href="/" aria-label="Home" title="Home" rel="home">
                    <span class="site-logo__image">
                      <svg class="site-logo__svg" viewBox="0 0 1061 147" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
                        <path d="M112.8 53.5C108 72.1 89.9 86.8 69.9 86.8c-20.1 0-38-14.7-42.9-33.4h.2s9.8 10.3-.2 0c3.1 3.1 6.2 4.4 10.7 4.4s7.7-1.3 10.7-4.4c3.1 3.1 6.3 4.5 10.9 4.4 4.5 0 7.6-1.3 10.7-4.4 3.1 3.1 6.2 4.4 10.7 4.4 4.5 0 7.7-1.3 10.7-4.4 3.1 3.1 6.3 4.5 10.9 4.4 4.3 0 7.4-1.2 10.5-4.3zM113.2 43.5c0-24-19.4-43.5-43.3-43.5-24 0-43.5 19.5-43.5 43.5h39.1c-4.8-1.8-8.1-6.3-8.1-11.6 0-7 5.7-12.5 12.5-12.5 7 0 12.7 5.5 12.7 12.5 0 5.2-3.1 9.6-7.6 11.6h38.2zM72.6 139.3c.7-36.9 29.7-68.8 66.9-70 0 37.2-30 68-66.9 70zM67.1 139.3c-.7-36.9-29.7-68.8-67.1-70 0 37.2 30.2 68 67.1 70zM240 3.1h-87.9v133.1H240v-20.4h-60.3v-36H240v-21h-60.3v-35H240V3.1zM272.8 58.8h27.1c9.1 0 15.2-8.6 15.1-17.7-.1-9-6.1-17.3-15.1-17.3h-25.3v112.4h-27.8V3.1h62.3c20.2 0 35 17.8 35.2 38 .2 20.4-14.8 38.7-35.2 38.7h-36.3v-21zM315.9 136.2h29.7l12.9-35h54.2l-8.1-21.9h-38.4l18.9-50.7 39.2 107.6H454L400.9 3.1h-33.7l-51.3 133.1zM473.3.8v22.4c0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7 1.8-4.1 2.7-7.1 2.7-.9 0-2.1-.2-3.6-.6-.7-.2-1.4-.6-2.2-1-.8-.4-1.5-1-2.2-1.7-.7-.9-1.4-2.1-2-3.6-.6-1.5-.9-3.5-.9-6.1 0-2.6.4-4.8 1.1-6.6.7-1.7 1.6-3.1 2.7-4.2 1.1-1 2.3-1.8 3.6-2.2 1.3-.4 2.5-.6 3.7-.6h1.6c.6.1 1.3.2 1.9.4.7.2 1.4.5 2.1 1 .7.4 1.3 1 1.8 1.7.9 1.1 1.4 2.1 1.7 3.1.2 1 .3 1.8.3 2.6H607zM629.1 137.1l-3.4 9.3H621l3.8-9.6-10.3-25h5.2l7.6 19.8 7.7-19.8h5z"/>
                      </svg>
                    </span>
                  </a>
                  <button class="usa-menu-btn usa-button l-header__menu-button">Menu</button>
                </div>

                <div class="l-header__search">
                  <form class="usa-search usa-search--small usa-search--epa" method="get" action="https://search.epa.gov/epasearch">
                    <div role="search">
                      <label class="usa-sr-only" for="search-box">Search</label>
                      <input class="usa-input" id="search-box" type="search" name="querytext" placeholder="Search EPA.gov">


                      <button class="usa-button usa-search__submit" style="height:2rem;margin:0;padding:0;padding-left:1rem;padding-right:1rem;border-top-left-radius: 0;border-bottom-left-radius: 0;">
                        <span class="usa-sr-only">Search</span>
                      </button>
                      <input type="hidden" name="areaname" value="">
                      <input type="hidden" name="areacontacts" value="">
                      <input type="hidden" name="areasearchurl" value="">
                      <input type="hidden" name="typeofsearch" value="epa">
                      <input type="hidden" name="result_template" value="">
                    </div>
                  </form>
                </div>

              </div>

            </div>
            <div class="l-header__nav">
              <nav class="usa-nav usa-nav--epa" role="navigation" aria-label="EPA header navigation">
                <div class="usa-nav__inner">
                  <button class="usa-nav__close" aria-label="Close">
                    <svg class="icon icon--nav-close" aria-hidden="true" role="img">
                      <title>Primary navigation</title>
                      <use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#close"></use>
                    </svg> </button>
                  <div class="usa-nav__menu">
                     <ul class="menu menu--main">
                      <li class="menu__item"><a href="https://www.epa.gov/environmental-topics" class="menu__link">Environmental Topics</a></li>
                      <li class="menu__item"><a href="https://www.epa.gov/laws-regulations" class="menu__link" >Laws &amp; Regulations</a></li>
                      <li class="menu__item"><a href="https://www.epa.gov/report-violation" class="menu__link" >Report a Violation</a></li>
                      <li class="menu__item"><a href="https://www.epa.gov/aboutepa" class="menu__link" >About EPA</a></li>
                    </ul>
                  </div>
                </div>
              </nav>
            </div>
          </header>


          <main id="main" class="main" role="main" tabindex="-1">'
      
      #)    ,   #   comment  out when excluding html below
      
    ) # END OF   html_header_fmt()
    ########################################################################## #
     # end of large header
  }
)


html_footer_fmt <- tagList(
  if (!show_full_header_footer) {
    ### SMALL/NO FOOTER ####
    # 
    HTML(
      ' 
      </div>
      
      <div class="l-page__footer">
        
      </div>
      
    </div>'
    )
  } else {
    ### (OPTIONAL LARGER FOOTER) ####
    HTML(
      '</main>
        <footer class="footer" role="contentinfo">
        <div class="l-constrain">
          <img class="footer__epa-seal" src="https://www.epa.gov/themes/epa_theme/images/epa-seal.svg" alt="United States Environmental Protection Agency" height="100" width="100">
          <div class="footer__content contextual-region">
            <div class="footer__column">
              <h2>Discover.</h2>
              <ul class="menu menu--footer">
                <li class="menu__item">
                  <a href="https://www.epa.gov/accessibility" class="menu__link">Accessibility</a>
                </li>
                <!--li class="menu__item"><a href="#" class="menu__link">EPA Administrator</a></li-->
                <li class="menu__item">
                  <a href="https://www.epa.gov/planandbudget" class="menu__link">Budget &amp; Performance</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/contracts" class="menu__link">Contracting</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/home/wwwepagov-snapshots" class="menu__link">EPA www Web Snapshot</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/grants" class="menu__link">Grants</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/ocr/whistleblower-protections-epa-and-how-they-relate-non-disclosure-agreements-signed-epa-employees" class="menu__link">No FEAR Act Data</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/web-policies-and-procedures/plain-writing" class="menu__link">Plain Writing</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/privacy" class="menu__link">Privacy</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/privacy/privacy-and-security-notice" class="menu__link">Privacy and Security Notice</a>
                </li>
              </ul>
            </div>
            <div class="footer__column">
              <h2>Connect.</h2>
              <ul class="menu menu--footer">
                <li class="menu__item">
                  <a href="https://www.data.gov/" class="menu__link">Data.gov</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/office-inspector-general/about-epas-office-inspector-general" class="menu__link">Inspector General</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/careers" class="menu__link">Jobs</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/newsroom" class="menu__link">Newsroom</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/data" class="menu__link">Open Government</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.regulations.gov/" class="menu__link">Regulations.gov</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/newsroom/email-subscriptions-epa-news-releases" class="menu__link">Subscribe</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.usa.gov/" class="menu__link">USA.gov</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.whitehouse.gov/" class="menu__link">White House</a>
                </li>
              </ul>
            </div>
            <div class="footer__column">
              <h2>Ask.</h2>
              <ul class="menu menu--footer">
                <li class="menu__item">
                  <a href="https://www.epa.gov/home/forms/contact-epa" class="menu__link">Contact EPA</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/web-policies-and-procedures/epa-disclaimers" class="menu__link">EPA Disclaimers</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/aboutepa/epa-hotlines" class="menu__link">Hotlines</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/foia" class="menu__link">FOIA Requests</a>
                </li>
                <li class="menu__item">
                  <a href="https://www.epa.gov/home/frequent-questions-specific-epa-programstopics" class="menu__link">Frequent Questions</a>
                </li>
              </ul>
              <h2>Follow.</h2>
              <ul class="menu menu--social">
                <li class="menu__item">
                  <a class="menu__link" aria-label="EPA’s Facebook" href="https://www.facebook.com/EPA">
                    <!-- svg class="icon icon--social" aria-hidden="true" -->
                    <svg class="icon icon--social" aria-hidden="true" viewBox="0 0 448 512" id="facebook-square" xmlns="http://www.w3.org/2000/svg">
                      <!-- use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#facebook-square"></use-->
                      <path fill="currentcolor" d="M400 32H48A48 48 0 000 80v352a48 48 0 0048 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0048-48V80a48 48 0 00-48-48z"></path>
                    </svg>
                    <span class="usa-tag external-link__tag" title="Exit EPA Website">
                      <span aria-hidden="true">Exit</span>
                      <span class="u-visually-hidden"> Exit EPA Website</span>
                    </span>
                  </a>
                </li>
                <li class="menu__item">
                  <a class="menu__link" aria-label="EPA’s Twitter" href="https://twitter.com/epa">
                    <!-- svg class="icon icon--social" aria-hidden="true" -->
                    <svg class="icon icon--social" aria-hidden="true" viewBox="0 0 448 512" id="twitter-square" xmlns="http://www.w3.org/2000/svg">
                      <!-- use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#twitter-square"></use -->
                      <path fill="currentcolor" d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 01-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"></path>
                    </svg>
                    <span class="usa-tag external-link__tag" title="Exit EPA Website">
                      <span aria-hidden="true">Exit</span>
                      <span class="u-visually-hidden"> Exit EPA Website</span>
                    </span>
                  </a>
                </li>
                <li class="menu__item">
                  <a class="menu__link" aria-label="EPA’s Youtube" href="https://www.youtube.com/user/USEPAgov">
                    <!-- svg class="icon icon--social" aria-hidden="true" -->
                    <svg class="icon icon--social" aria-hidden="true" viewBox="0 0 448 512" id="youtube-square" xmlns="http://www.w3.org/2000/svg">
                      <!-- use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#youtube-square"></use -->
                      <path fill="currentcolor" d="M186.8 202.1l95.2 54.1-95.2 54.1V202.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-42 176.3s0-59.6-7.6-88.2c-4.2-15.8-16.5-28.2-32.2-32.4C337.9 128 224 128 224 128s-113.9 0-142.2 7.7c-15.7 4.2-28 16.6-32.2 32.4-7.6 28.5-7.6 88.2-7.6 88.2s0 59.6 7.6 88.2c4.2 15.8 16.5 27.7 32.2 31.9C110.1 384 224 384 224 384s113.9 0 142.2-7.7c15.7-4.2 28-16.1 32.2-31.9 7.6-28.5 7.6-88.1 7.6-88.1z"></path>
                    </svg>
                    <span class="usa-tag external-link__tag" title="Exit EPA Website">
                      <span aria-hidden="true">Exit</span>
                      <span class="u-visually-hidden"> Exit EPA Website</span>
                    </span>
                  </a>
                </li>
                <li class="menu__item">
                  <a class="menu__link" aria-label="EPA’s Flickr" href="https://www.flickr.com/photos/usepagov">
                    <!-- svg class="icon icon--social" aria-hidden="true" -->
                    <svg class="icon icon--social" aria-hidden="true" viewBox="0 0 448 512" id="flickr-square" xmlns="http://www.w3.org/2000/svg">
                      <!-- use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#flickr-square"></use -->
                      <path fill="currentcolor" d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM144.5 319c-35.1 0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5zm159 0c-35.1 0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5z"></path>
                    </svg>
                    <span class="usa-tag external-link__tag" title="Exit EPA Website">
                      <span aria-hidden="true">Exit</span>
                      <span class="u-visually-hidden"> Exit EPA Website</span>
                    </span>
                  </a>
                </li>
                <li class="menu__item">
                  <a class="menu__link" aria-label="EPA’s Instagram" href="https://www.instagram.com/epagov">
                    <!-- svg class="icon icon--social" aria-hidden="true" -->
                    <svg class="icon icon--social" aria-hidden="true" viewBox="0 0 448 512" id="instagram-square" xmlns="http://www.w3.org/2000/svg">
                      <!-- use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#instagram-square"></use -->
                      <path fill="currentcolor" xmlns="http://www.w3.org/2000/svg" d="M224 202.66A53.34 53.34 0 10277.36 256 53.38 53.38 0 00224 202.66zm124.71-41a54 54 0 00-30.41-30.41c-21-8.29-71-6.43-94.3-6.43s-73.25-1.93-94.31 6.43a54 54 0 00-30.41 30.41c-8.28 21-6.43 71.05-6.43 94.33s-1.85 73.27 6.47 94.34a54 54 0 0030.41 30.41c21 8.29 71 6.43 94.31 6.43s73.24 1.93 94.3-6.43a54 54 0 0030.41-30.41c8.35-21 6.43-71.05 6.43-94.33s1.92-73.26-6.43-94.33zM224 338a82 82 0 1182-82 81.9 81.9 0 01-82 82zm85.38-148.3a19.14 19.14 0 1119.13-19.14 19.1 19.1 0 01-19.09 19.18zM400 32H48A48 48 0 000 80v352a48 48 0 0048 48h352a48 48 0 0048-48V80a48 48 0 00-48-48zm-17.12 290c-1.29 25.63-7.14 48.34-25.85 67s-41.4 24.63-67 25.85c-26.41 1.49-105.59 1.49-132 0-25.63-1.29-48.26-7.15-67-25.85s-24.63-41.42-25.85-67c-1.49-26.42-1.49-105.61 0-132 1.29-25.63 7.07-48.34 25.85-67s41.47-24.56 67-25.78c26.41-1.49 105.59-1.49 132 0 25.63 1.29 48.33 7.15 67 25.85s24.63 41.42 25.85 67.05c1.49 26.32 1.49 105.44 0 131.88z"></path>
                    </svg>
                    <span class="usa-tag external-link__tag" title="Exit EPA Website">
                      <span aria-hidden="true">Exit</span>
                      <span class="u-visually-hidden"> Exit EPA Website</span>
                    </span>
                  </a>
                </li>
              </ul>
              <p class="footer__last-updated">
                Last updated on March 30, 2022
              </p>
            </div>
          </div>
        </div>
      </footer>
      <a href="#" class="back-to-top" title="" aria-label="back-to-top">
        <svg class="back-to-top__icon" aria-label="">
        <svg class="back-to-top__icon" aria-label="" viewBox="0 0 19 12" id="arrow" xmlns="http://www.w3.org/2000/svg">
          <!-- use xlink:href="https://www.epa.gov/themes/epa_theme/images/sprite.artifact.svg#arrow"></use -->
          <path fill="currentColor" d="M2.3 12l7.5-7.5 7.5 7.5 2.3-2.3L9.9 0 .2 9.7 2.5 12z"></path>
        </svg>
      </a>'
    ) # end of large footer
  }
  # ,
  # 
  
)
